home *** CD-ROM | disk | FTP | other *** search
/ Knitting Made Easy / Knitting.iso / App / Patterns.dxr / behaviors_62_DirectMedia Xtra Controller Button.ls < prev    next >
Encoding:
Text File  |  2002-04-18  |  3.4 KB  |  61 lines

  1. property videoSprite, VideoCommand, standardImage, alternateImage, clickedImage, param1, param2
  2.  
  3. on DoControl me
  4.   case me.VideoCommand of
  5.     #play:
  6.       videoplay(sprite(me.videoSprite))
  7.     #pause:
  8.       videopause(sprite(me.videoSprite))
  9.     #rewind:
  10.       videoseek(sprite(me.videoSprite), sprite(me.videoSprite).segmentstart)
  11.     #StepForward:
  12.       videopause(sprite(me.videoSprite))
  13.       videoseek(sprite(me.videoSprite), sprite(me.videoSprite).currentTime + 30)
  14.     #StepBackward:
  15.       videopause(sprite(me.videoSprite))
  16.       videoseek(sprite(me.videoSprite), sprite(me.videoSprite).currentTime - 30)
  17.     #Seek:
  18.       videoseek(sprite(me.videoSprite), me.param1)
  19.     #playsegment:
  20.       videoplaysegment(sprite(me.videoSprite), me.param1, me.param2)
  21.   end case
  22. end
  23.  
  24. on mouseUp me
  25.   set the member of sprite the spriteNum of me to me.standardImage
  26.   DoControl(me)
  27. end
  28.  
  29. on mouseDown me
  30.   set the member of sprite the spriteNum of me to me.clickedImage
  31. end
  32.  
  33. on mouseEnter me
  34.   set the member of sprite the spriteNum of me to me.alternateImage
  35. end
  36.  
  37. on mouseLeave me
  38.   set the member of sprite the spriteNum of me to me.standardImage
  39. end
  40.  
  41. on beginSprite me
  42.   me.standardImage = the member of sprite me.spriteNum
  43. end
  44.  
  45. on getPropertyDescriptionList
  46.   if the currentSpriteNum = 0 then
  47.     memdefault = 0
  48.   else
  49.     memref = the member of sprite the currentSpriteNum
  50.     castLibNum = memref.castLibNum
  51.     memdefault = member(member(memref).memberNum + 1, castLibNum)
  52.     memdefault2 = member(member(memref).memberNum + 2, castLibNum)
  53.   end if
  54.   p_list = [#VideoCommand: [#comment: "Action:", #format: #symbol, #range: [#play, #pause, #rewind, #StepBackward, #StepForward, #Seek, #playsegment], #default: #play], #param1: [#comment: "First Parameter (Use with seek or playsegment):", #format: #long, #default: 0], #param2: [#comment: "Second Parameter (Use with playsegment):", #format: #long, #default: 0], #videoSprite: [#comment: "DirectMedia Sprite Channel:", #format: #integer, #default: 1], #alternateImage: [#comment: "Rollover Button Cast Member:", #format: #graphic, #default: memdefault], #clickedImage: [#comment: "Clicked Button Cast Member:", #format: #graphic, #default: memdefault2]]
  55.   return p_list
  56. end
  57.  
  58. on getBehaviorDescription
  59.   return "Used to create Play, Pause, StepForward, StepBackward, Rewind, Seek and PlaySegment control buttons for a DirectMedia Xtra video sprite. You can also attach rollover and alternate images for the clicked buttons" & RETURN & "PARAMETERS:" & RETURN & "Action - Choose the action to perform on mouseUP ( Play, Pause, Rewind, StepBackward, StepForward, Seek, PlaySegment )." & RETURN & "First Parameter: if the Action is Seek than this parameter contains the seek to time (in milliseconds). For the PlaySegment action this parameter contains the starting time of the segment to play (in milliseconds)" & RETURN & "Second Parameter: Used with the PlaySegment action. Contains the ending time of the segment to play (in milliseconds)" & RETURN & "DirectMedia Sprite Channel - Enter the number of sprite channel of the DirectMedia Xtra video that is being controlled." & RETURN & "Rollover Button: the castmember that will be used as the rollover image of the button. Default is the castmember located just after the button castmember" & RETURN & "Clicked Button: the castmember that will be used as the clicked image of the button. Default is the castmember located just after the rollover castmember"
  60. end
  61.